home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 050a.dms / 050a.adf / TEXTS / chapter11.txt < prev    next >
Text File  |  1992-02-26  |  5KB  |  165 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                                 Chapter eleven
  4.                                 --------------
  5.  
  6. I think it`s high time we took a closer look at memory banks.
  7. EXAMPLE11.Amos listed below, is a mini slide show with music program.
  8.  
  9. REM  Mini slideshow with fades and music
  10. '-------------------------------------- 
  11. HIDE: TRACK LOOP ON: TRACK PLAY 5 
  12. BEGIN:
  13. UNPACK 12 TO 0
  14. WAIT 400
  15. FADE 5
  16. WAIT 75
  17. UNPACK 11 to 0
  18. WAIT 400
  19. FADE 1
  20. WAIT 15
  21. UNPACK 10 TO 0
  22. WAIT 400
  23. FADE 10
  24. WAIT 150 
  25. GOTO BEGIN
  26.  
  27. Hold on! Where are the LOAD IFF and TRACK LOAD commands for the pictures and 
  28. music? The answer is, we don`t need them, because the pictures and music
  29. are already stored inside the program, in memory banks.  First I will explain
  30. about the music. Imagine you have just loaded up Amos and you are sitting in
  31. front of the blank editor. Press escape to go into direct mode, now type in:
  32.  
  33. TRACK LOAD "DF0:MUSIC/MOD.FUN",5
  34.  
  35. This is the same line that we would normally use in a program to LOAD the
  36. the music.  Obviously you can change the name of the file you want to load 
  37. from MOD.FUN to that of your choice.
  38.  
  39. The music is now stored in bank five. Staying in Direct mode type: 
  40.  
  41. TRACK PLAY 5  
  42.  
  43. and you will now hear the music play.
  44.  
  45. When you save the program the contents of any permanent memory bank in use is
  46. saved along with the basic listing and when you reload it the music will 
  47. still be there in bank five.  So a simple, TRACK PLAY 5, will start it again.
  48. There are certain types of banks that are not saved along with the program 
  49. but we are not concerned with that at the moment as we are concentrating on 
  50. music and pictures.
  51.  
  52. The pictures use the same technique. When I wrote the Mini Slideshow program 
  53. I loaded the music into bank five as described then I loaded a picture from 
  54. disk into the default screen (0) like this:
  55.  
  56. LOAD IFF "DF0:PICS/SONIC.IFF",0
  57.  
  58. The same as we would inside a program, but staying in direct mode. 
  59. I then typed the magical command:
  60.  
  61. SPACK 0 to 10
  62.  
  63. Which tells Amos to sPACK the picture currently in screen 0 and store a
  64. compressed copy of it in bank ten. I repeated this for two more pictures 
  65. LOADing them into screen 0 and then SPACKing them into banks 11 and 12.
  66. I then typed: 
  67.  
  68. LISTBANK
  69.  
  70. to check the banks were there and then returned to the blank editor to save 
  71. the blank program listing off which automatically saved the banks along with
  72. it. To display a SPACKed picture from a bank we use the command:
  73.  
  74. UNPACK bank TO screen
  75.  
  76. So if for example we had a picture stored in bank 7 and we wanted to UNPACK
  77. it to the default screen we would use:
  78.  
  79. UNPACK 7 TO 0
  80.  
  81. And that is all there is to it.  The benefits of SPACKING pictures are that
  82. because they are packed they use up less memory and disk space, keep the
  83. program listing free of LOAD commands and no slow disk access is required.
  84.  
  85. Note: When you UNPACK a picture it does not erase the bank so you can keep
  86.       UNPACKING as many copies of the picture as you need. If you do need or
  87.       want to delete the picture from the bank just use ERASE bank number.
  88.       For example, ERASE 10, and the memory previously used by that bank
  89.       should be returned for use to your program.
  90.  
  91. Note2: Amos automatically uses the palette of any picture you unpack in case
  92.        you were wondering!
  93.  
  94. So to the program breakdown:
  95.  
  96.   
  97. HIDE: TRACK LOOP ON: TRACK PLAY 5
  98. ----------------------------------
  99. Hide the mouse pointer to keep things tidy. Set the music to LOOP. 
  100. PLAY the music that is stored in bank five.
  101.  
  102. BEGIN:
  103. ------
  104. A label (or marker if you like) for GOTO to -  GO TO .
  105.  
  106. UNPACK 12 TO 0
  107. --------------
  108. Unpack the previously SPACKED picture from bank 12 to screen 0.
  109.  
  110. WAIT 400
  111. --------
  112. WAIT eight seconds to give the user time to view the picture.
  113.  
  114. FADE 5
  115. ------
  116. Literally FADEs the screen to black, try different values if you like.
  117.  
  118. WAIT 75
  119. -------
  120. This WAIT is necessary to give the FADE enough time to finish, you can 
  121. work out the exact timing by using FADE speed*15 (5*15=75)
  122.  
  123. UNPACK 11 to 0
  124. --------------
  125. Unpack the picture in bank 11 to screen 0.
  126.  
  127. WAIT 400
  128. --------
  129. Wait 8 seconds.
  130.  
  131. FADE 1
  132. ------
  133. Try a different fade.
  134.  
  135. WAIT 15
  136. -------
  137. WAIT 1*15
  138.  
  139. UNPACK 10 TO 0
  140. --------------
  141. Unpack bank 10 to screen 0.
  142.  
  143. WAIT 400
  144. --------
  145. Guess!
  146.  
  147. FADE 10
  148. -------
  149. FADE it out.
  150.  
  151. WAIT 150
  152. --------
  153. Give the FADE time to do it`s job.
  154.  
  155. GOTO BEGIN
  156. ----------
  157. Jump to the line marked LABEL and start unpacking the pics again.
  158.  
  159. As a bit of homework why not change the pictures, music and FADEs?
  160. Try changing the WAIT N to, CLEAR KEY: WAIT KEY, so the user can view the
  161. picture as long as he/she wants to.
  162.  
  163.                             End of chapter eleven
  164.                             ^^^^^^^^^^^^^^^^^^^^^
  165.